<%--
  Created by IntelliJ IDEA.
  User: xieyihong
  Date: 2021/1/11
  Time: 10:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户管理中心</title>
</head>
<body>
  <form action="" method="post">
      <input type="text" placeholder="请输入用户名">
      <input type="button" onclick="doSelect()">
  </form>
  <script src="jquery/jquery-2.1.1.min.js"></script>
  <script src="layer/layer.js"></script>
<script>
    function doSelect() {
       var username = $("#username").val();
        //提交表单
        var loadingIndex=null;
        $.ajax({
            type:"POST",
            url:"doAjaxUserSelect",
            data:{"username":username},
            beforeSend:function(){
                loadingIndex = layer.msg('查询中', {icon: 16});
            },
            success:function(result){
                layer.close(loadingIndex);
                if(result.success){
                    //后台验证用户的信息成功之后，跳转到index.jsp页面
                    window.location.href = "userSelect";
                }else{
                    layer.msg("用户的名字输入不正确，请重新输入！", {time:2000, icon:2, shift:6}, function(){});
                }
            }
        });
    }
</script>
</body>
</html>
